*****************************************************************************************************************************************************
* PROJECT: 		Exposure to the COVID-19 Stock Market Crash and its Effect on Household Expectations
* DATE: 		Nov 2020
* CONTENT: 		TABLES
* AUTHORS: 		Tobin Hanspal, Johannes Wohlfart, Anni Weber
*****************************************************************************************************************************************************

		clear all
		set scheme lean2
		global pm = char(177)
		set more off
		gl date = c(current_date)
		graph set window fontface "cmr10"		
		
* set cd as /Replication_files_HanspalWeberWohlfart2020/

*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~						
** Table A8
*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~	
	
use data/processed/data_1, clear 

* adjust variables
replace planned_morestocks=. if stockowner==0
replace planned_lessstocks=. if stockowner==0

foreach var of varlist expec_debthigher expec_morehrs expec_retirlater never_ownwealth never_owninc ///
realized_anychangestocks realized_morestocks realized_lessstocks planned_anychangestocks planned_morestocks planned_lessstocks {
	gen `var'_00=100* `var' 
}
* 

global controls ln_hhnetinc hhnetinc19_NR ///
	ln_ofinwealth_lvl ln_retirewealth_lvl ///
	ln_realestate_lvl realestJan20_NR ///
	ln_debt_lvl  debtJan20_NR ///
	stockinvestor riskshare_finwealth_Jan201 stockexperience ///
	i.agecat male married separated_divorced widowed ///	
	highschool some_college_associate_degree atleast_bachelor  ///
	z_decisionmaker mainearner_alone self_empl retired unempl empl_other z_constrained ///
	republican other_party NR_party  ///
	i.region ///
	i.svydate

loc experiments "recov_hhwealth_duration z_finprospect planned_morestocks_00 planned_lessstocks_00 del_spend20_perc_tr02 expec_debthigher_00 expec_morehrs_00 expec_retirlater_00"
loc experiments1 "recov_hhwealth_duration z_finprospect"
loc experiments2 "del_spend20_perc_tr02 expec_debthigher_00 expec_morehrs_00 expec_retirlater_00"

preserve

clear all
eststo clear
estimates drop _all

set obs 10
qui gen x = 1
qui gen y = 1

loc columns = 0

foreach choice in `experiments' {

    loc ++columns
    qui eststo col`columns': reg x y

}

restore

loc colnum = 1
loc colnames ""


foreach choice in `experiments1' {
reg `choice' treated prior $controls, r, if arm_fincrisis==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat2 = "`r(bstar)'": col`colnum'
estadd loc thisstat3 = "`r(sestar)'": col`colnum'

reg `choice' treated prior $controls, r, if arm_fincrisis==1 & percgap>0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat5 = "`r(bstar)'": col`colnum'
estadd loc thisstat6 = "`r(sestar)'": col`colnum'

reg `choice' treated prior $controls, r, if arm_fincrisis==1 & percgap>0 & stockowner==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat8 = "`r(bstar)'": col`colnum'
estadd loc thisstat9 = "`r(sestar)'": col`colnum'

***

reg `choice' treated prior $controls, r, if arm_dotcom==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat12 = "`r(bstar)'": col`colnum'
estadd loc thisstat13 = "`r(sestar)'": col`colnum'

reg `choice' treated prior $controls, r, if arm_dotcom==1 & percgap>0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat15 = "`r(bstar)'": col`colnum'
estadd loc thisstat16 = "`r(sestar)'": col`colnum'

reg `choice' treated prior $controls, r, if arm_dotcom==1 & percgap>0 & stockowner==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat18 = "`r(bstar)'": col`colnum'
estadd loc thisstat19 = "`r(sestar)'": col`colnum'

***

reg `choice' treated prior $controls, r, if arm_black==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat22 = "`r(bstar)'": col`colnum'
estadd loc thisstat23 = "`r(sestar)'": col`colnum'

reg `choice' treated prior $controls, r, if arm_black==1 & percgap<0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat25 = "`r(bstar)'": col`colnum'
estadd loc thisstat26 = "`r(sestar)'": col`colnum'

reg `choice' treated prior $controls, r, if arm_black==1 & percgap<0 & stockowner==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat28 = "`r(bstar)'": col`colnum'
estadd loc thisstat29 = "`r(sestar)'": col`colnum'



estadd loc thisstat31 "Yes": col`colnum'
*estadd loc thisstat36= `r2': col`colnum'
*estadd loc thisstat37 = `N': col`colnum'



loc ++colnum
loc colnames "`colnames' `"`: var la `choice''"'"

}



reg planned_morestocks_00 treated i.stocktrades_realized prior $controls, r, if arm_fincrisis==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat2 = "`r(bstar)'": col`colnum'
estadd loc thisstat3 = "`r(sestar)'": col`colnum'

reg planned_morestocks_00 treated i.stocktrades_realized prior $controls, r, if arm_fincrisis==1 & percgap>0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat5 = "`r(bstar)'": col`colnum'
estadd loc thisstat6 = "`r(sestar)'": col`colnum'

reg planned_morestocks_00 i.stocktrades_realized treated prior $controls, r, if arm_fincrisis==1 & percgap>0 & stockowner==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat8 = "`r(bstar)'": col`colnum'
estadd loc thisstat9 = "`r(sestar)'": col`colnum'

***

reg planned_morestocks_00 i.stocktrades_realized treated prior $controls, r, if arm_dotcom==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat12 = "`r(bstar)'": col`colnum'
estadd loc thisstat13 = "`r(sestar)'": col`colnum'

reg planned_morestocks_00 i.stocktrades_realized treated prior $controls, r, if arm_dotcom==1 & percgap>0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat15 = "`r(bstar)'": col`colnum'
estadd loc thisstat16 = "`r(sestar)'": col`colnum'

reg planned_morestocks_00 i.stocktrades_realized treated prior $controls, r, if arm_dotcom==1 & percgap>0 & stockowner==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat18 = "`r(bstar)'": col`colnum'
estadd loc thisstat19 = "`r(sestar)'": col`colnum'

***

reg planned_morestocks_00 i.stocktrades_realized treated prior $controls, r, if arm_black==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat22 = "`r(bstar)'": col`colnum'
estadd loc thisstat23 = "`r(sestar)'": col`colnum'

reg planned_morestocks_00 i.stocktrades_realized treated prior $controls, r, if arm_black==1 & percgap<0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat25 = "`r(bstar)'": col`colnum'
estadd loc thisstat26 = "`r(sestar)'": col`colnum'

reg planned_morestocks_00 i.stocktrades_realized treated prior $controls, r, if arm_black==1 & percgap<0 & stockowner==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat28 = "`r(bstar)'": col`colnum'
estadd loc thisstat29 = "`r(sestar)'": col`colnum'



estadd loc thisstat31 "Yes": col`colnum'
*estadd loc thisstat36= `r2': col`colnum'
*estadd loc thisstat37 = `N': col`colnum'



loc ++colnum
loc colnames "`colnames' `"`: var la `choice''"'"

reg planned_lessstocks_00 i.stocktrades_realized treated prior $controls, r, if arm_fincrisis==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat2 = "`r(bstar)'": col`colnum'
estadd loc thisstat3 = "`r(sestar)'": col`colnum'

reg planned_lessstocks_00 i.stocktrades_realized treated prior $controls, r, if arm_fincrisis==1 & percgap>0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat5 = "`r(bstar)'": col`colnum'
estadd loc thisstat6 = "`r(sestar)'": col`colnum'

reg planned_lessstocks_00 i.stocktrades_realized treated prior $controls, r, if arm_fincrisis==1 & percgap>0 & stockowner==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat8 = "`r(bstar)'": col`colnum'
estadd loc thisstat9 = "`r(sestar)'": col`colnum'

***

reg planned_lessstocks_00 i.stocktrades_realized treated prior $controls, r, if arm_dotcom==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat12 = "`r(bstar)'": col`colnum'
estadd loc thisstat13 = "`r(sestar)'": col`colnum'

reg planned_lessstocks_00 i.stocktrades_realized treated prior $controls, r, if arm_dotcom==1 & percgap>0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat15 = "`r(bstar)'": col`colnum'
estadd loc thisstat16 = "`r(sestar)'": col`colnum'

reg planned_lessstocks_00 i.stocktrades_realized treated prior $controls, r, if arm_dotcom==1 & percgap>0 & stockowner==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat18 = "`r(bstar)'": col`colnum'
estadd loc thisstat19 = "`r(sestar)'": col`colnum'

***

reg planned_lessstocks_00 i.stocktrades_realized treated prior $controls, r, if arm_black==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat22 = "`r(bstar)'": col`colnum'
estadd loc thisstat23 = "`r(sestar)'": col`colnum'

reg planned_lessstocks_00 i.stocktrades_realized treated prior $controls, r, if arm_black==1 & percgap<0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat25 = "`r(bstar)'": col`colnum'
estadd loc thisstat26 = "`r(sestar)'": col`colnum'

reg planned_lessstocks_00 i.stocktrades_realized treated prior $controls, r, if arm_black==1 & percgap<0 & stockowner==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat28 = "`r(bstar)'": col`colnum'
estadd loc thisstat29 = "`r(sestar)'": col`colnum'



estadd loc thisstat31 "Yes": col`colnum'
*estadd loc thisstat36= `r2': col`colnum'
*estadd loc thisstat37 = `N': col`colnum'



loc ++colnum
loc colnames "`colnames' `"`: var la `choice''"'"


foreach choice in `experiments2' {
reg `choice' treated prior $controls, r, if arm_fincrisis==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat2 = "`r(bstar)'": col`colnum'
estadd loc thisstat3 = "`r(sestar)'": col`colnum'

reg `choice' treated prior $controls, r, if arm_fincrisis==1 & percgap>0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat5 = "`r(bstar)'": col`colnum'
estadd loc thisstat6 = "`r(sestar)'": col`colnum'

reg `choice' treated prior $controls, r, if arm_fincrisis==1 & percgap>0 & stockowner==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat8 = "`r(bstar)'": col`colnum'
estadd loc thisstat9 = "`r(sestar)'": col`colnum'

***

reg `choice' treated prior $controls, r, if arm_dotcom==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat12 = "`r(bstar)'": col`colnum'
estadd loc thisstat13 = "`r(sestar)'": col`colnum'

reg `choice' treated prior $controls, r, if arm_dotcom==1 & percgap>0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat15 = "`r(bstar)'": col`colnum'
estadd loc thisstat16 = "`r(sestar)'": col`colnum'

reg `choice' treated prior $controls, r, if arm_dotcom==1 & percgap>0 & stockowner==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat18 = "`r(bstar)'": col`colnum'
estadd loc thisstat19 = "`r(sestar)'": col`colnum'

***

reg `choice' treated prior $controls, r, if arm_black==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat22 = "`r(bstar)'": col`colnum'
estadd loc thisstat23 = "`r(sestar)'": col`colnum'

reg `choice' treated prior $controls, r, if arm_black==1 & percgap<0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat25 = "`r(bstar)'": col`colnum'
estadd loc thisstat26 = "`r(sestar)'": col`colnum'

reg `choice' treated prior $controls, r, if arm_black==1 & percgap<0 & stockowner==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar treated , prec(3)
estadd loc thisstat28 = "`r(bstar)'": col`colnum'
estadd loc thisstat29 = "`r(sestar)'": col`colnum'



estadd loc thisstat31 "Yes": col`colnum'
*estadd loc thisstat36= `r2': col`colnum'
*estadd loc thisstat37 = `N': col`colnum'



loc ++colnum
loc colnames "`colnames' `"`: var la `choice''"'"

}


loc rowlabels " "{\bf Panel A: All}" "Info Fin. Crisis 2007" " " " {\bf Panel B: Underestimators}" "Info Fin. Crisis 2007" " " " {\bf Panel C: Under. \& $\text{Stocks}>0$}" "Info Fin. Crisis 2007" " " " " "\hline {\bf Panel D: All}" "Info Dot-com 2000" " " "{\bf Panel E: Underestimators}" "Info Dot-com 2000" " " "{\bf Panel F: Under. \& $\text{Stocks}>0$}" "Info Dot-com 2000" " " " " "\hline {\bf Panel G: All}" "Info Black Monday 1987" " " "{\bf Panel H: Overestimators}" "Info Black Monday 1987" " " "{\bf Panel I: Over. \& $\text{Stocks}>0$}" "Info Black Monday 1987" " " " " "\hline Individual controls" " 

forval i = 1/31 {
    loc rowstats "`rowstats' thisstat`i'"
}

esttab * using "Tables/TableA8.tex", replace cells(none) booktabs nonotes nomtitles compress alignment(c) nogap noobs nobaselevels label stats(`rowstats', labels(`rowlabels')) ///
     mgroups("\shortstack{Wealth\\recovery\\duration}" "\shortstack{Household\\ financial \\ prospects}" "\shortstack{Plan incr. \\ stock \\ share}" "\shortstack{Plan decr. \\ stock \\ share}"  "\shortstack{Exp.\\spend.\\growth}" "\shortstack{Incr.\\ exp.\\ debt}" "\shortstack{Incr. exp. \\ desired \\ hours}" "\shortstack{Incr. exp.\\ retirement \\ age}" , pattern(1 1 1 1 1 1 1 1  ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))





